package com.bootdo.common.enums;

/**
 * @author Mr.Zeng
 * @date 2017/11/24 15:25
 */

import lombok.Getter;

@Getter
public enum ResultEnum {


    PARAM_ERROR(1, "参数不正确"),
    SERVICE_ERROR(2,"服务器异常"),
    DATA_NOT_EXIST(3,"没有数据"),
    OPERATION_SUCCESS(4,"操作成功"),
    OPERATION_FAILD(5,"操作失败"),
    NOT_AGREE(6,"密码输入不一致，请重新输入"),
    USER_USE(7,"用户已存在"),
    PHONE_USE_REGISTER(8,"该号码已被注册"),
    LOGIN_SUCCESS(9,"登录成功"),
    LOGIN_FAIL(10,"登录失败,检查用户名和密码"),
    TOKEN_EXPIRE(11,"tonken过期"),
    TOKEN_VAILD_FAIL(12,"tonken验证失败"),
    INTEGRAL_INSUFFICIENT(13,"积分不足"),
    TRANSFER_FAIL(14,"转移失败"),
    CODE_EXIST(15,"该号码未发送验证码"),
    CODE_ERROR(16,"验证码错误"),
    PHONE_NOT_REGISTER(17,"用户未注册")
    ;



    ;
    private Integer code;
    private String message;

    ResultEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    public static String getMsg(Integer code){
        for (ResultEnum resultEnum : ResultEnum.values()){
            if (resultEnum.getCode().equals(code)){
                return resultEnum.getMessage();
            }
        }
        return null;
    }
}
